﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="BrowseUsers.aspx.cs" Inherits="JustTest.Admin.BrowseUsers" %>
<asp:Content ID="Content1" ContentPlaceHolderID="MainContent" runat="server">
    <asp:GridView ID="GridViewUsers" runat="server" ItemType="JustTest.Models.ApplicationUser"
        AutoGenerateColumns="false" AutoGenerateEditButton="true"
        DataKeyNames="Id"
        SelectMethod="GridView_GetData"
        UpdateMethod="GridView_UpdateItem"
        CssClass="table table-hover table-striped">
        <Columns>
            <asp:DynamicField DataField="FirstName" />
            <asp:DynamicField DataField="LastName" />
            <asp:TemplateField HeaderText="UserName">
                <ItemTemplate>
                    <asp:HyperLink CssClass="btn btn-inverse" Text="<%#: Item.UserName %>" 
                        NavigateUrl='<%#: "~/User/Profile.aspx?username=" + Item.UserName %>'
                        runat="server" />
                    <asp:Button Text='<%#: Item.Roles.Any(r=>r.Role.Name == "Author")? "Make User":"Make Author" %>' runat="server" 
                        OnClick="ButtonToggleAuthor_Click" CommandArgument="<%#: Item.Id %>"
                        CssClass="btn btn-info"/>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
    </asp:GridView>
</asp:Content>
